home *** CD-ROM | disk | FTP | other *** search
- ' Caption: GnuPG|
- ' Hint: Do some GnuPG actions|
- ' Icon: gpg.ico|
- '
- ' syn
- ' Copyright (C) 2000-2003, Ascher Stefan. All rights reserved.
- ' stievie@utanet.at, http://web.utanet.at/ascherst/
- '
- ' The contents of this file are subject to the Mozilla Public License
- ' Version 1.1 (the "License"); you may not use this file except in compliance
- ' with the License. You may obtain a copy of the License at
- ' http://www.mozilla.org/MPL/
- '
- ' Software distributed under the License is distributed on an "AS IS" basis,
- ' WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
- ' the specific language governing rights and limitations under the License.
- '
- ' The Original Code is cvs.vbs, released Sun, 28 Jul 2002 14:06:54 UTC.
- '
- ' The Initial Developer of the Original Code is Ascher Stefan.
- ' Portions created by Ascher Stefan are Copyright (C) 2000-2003 Ascher Stefan.
- ' All Rights Reserved.
- '
- ' Contributor(s): .
- '
- ' Alternatively, the contents of this file may be used under the terms of the
- ' GNU General Public License Version 2 or later (the "GPL"), in which case
- ' the provisions of the GPL are applicable instead of those above.
- ' If you wish to allow use of your version of this file only under the terms
- ' of the GPL and not to allow others to use your version of this file
- ' under the MPL, indicate your decision by deleting the provisions above and
- ' replace them with the notice and other provisions required by the GPL.
- ' If you do not delete the provisions above, a recipient may use your version
- ' of this file under either the MPL or the GPL.
- '
- ' You may retrieve the latest version of this file at the syn home page,
- ' located at http://syn.sourceforge.net/
- '
- ' $Id: gpg.vbs,v 1.1.2.2 2003/08/13 00:38:45 neum Exp $
- '
-
- ' ScriptEngine=VBScript
-
- option explicit
-
- ' Remove the dot to include this file(s)
- '#include <consts>
- '#include <cmnfunc>
-
- dim okbutton
- dim cancelbutton
-
- sub Main(FileName)
- if Documents.Count = 0 then
- MsgBox "There is currently no file open.", vbCritical
- exit sub
- end if
- if not CheckSave then
- exit sub
- end if
- dim gsxexe
- gsxexe = RegGetSettings("HKEY_LOCAL_MACHINE\SOFTWARE\Ascher\GnuPGShEx\", "")
- if gsxexe = "" then
- MsgBox "GPGSX not found." & vbCrLf & "This script requires GPGSX" & vbCrLf & "you can download it from http://web.utanet.at/ascherst/gpgsx/", vbCritical
- exit sub
- end if
-
- dim form
- form = Create("TForm", Self)
- with form
- .Caption = "GnuPG"
- .Position = "poOwnerFormCenter"
- .BorderStyle = "bsDialog"
- .Height = 300
- .Width = 350
- end with
- dim cbo
- cbo = Create("TComboBox", Self)
- with cbo
- .Parent = form
- .Top = 20
- .Left = 5
- .Width = form.ClientWidth - 10
- .Style = "csDropDownList"
- .Items.Add "Encrypt"
- .Items.Add "Decrypt"
- .Items.Add "Sign"
- .Items.Add "Verify"
- .ItemIndex = 0
- end with
- with Create("TLabel", Self)
- .Parent = form
- .Caption = "&Do what:"
- .Top = cbo.Top - 15
- .Left = 5
- .FocusControl = cbo
- end with
-
- dim list
-
- list = Create("TCheckListBox", Self)
- with list
- .Parent = form
- .Left = 5
- .Top = 60
- .Height = form.ClientHeight - 100
- .Width = form.ClientWidth - 10
- dim i, j
- for i = 0 to Documents.Count - 1
- if Documents(i).FileName <> "" then
- j = .Items.Add(Documents(i).FileName)
- .Checked(j) = true
- end if
- next
- end with
-
- with Create("TLabel", Self)
- .Parent = form
- .Caption = "&Select files:"
- .Top = list.Top - 15
- .Left = 5
- .FocusControl = list
- end with
- okbutton = Create("TButton", Self)
- with okbutton
- .Parent = form
- .Caption = "OK"
- .Default = true
- .Left = form.ClientWidth - (.Width + 5) * 2
- .Top = form.ClientHeight - .Height - 5
- .ModalResult = mrOK
- end with
- cancelbutton = Create("TButton", Self)
- with cancelbutton
- .Parent = form
- .Caption = "Cancel"
- .Cancel = true
- .Left = form.ClientWidth - .Width - 5
- .Top = form.ClientHeight - .Height - 5
- .ModalResult = mrCancel
- end with
-
- if form.ShowModal = mrOK then
-
- dim files
-
- for j = 0 to list.Items.Count - 1
- if list.Checked(j) then
- files = files & " " & AddQuotesUnless(list.Items(j))
- end if
- next
- if files <> "" then
- files = Trim(files)
- dim args
- select case cbo.ItemIndex
- case 0
- args = " -encrypt -files " & files
- case 1
- args = " -decrypt -files " & files
- case 2
- args = " -sign -files " & files
- case 3
- args = " -verify -files " & files
- end select
- end if
- Execute AddQuotesUnless(gsxexe) & args, 1, false
- end if
- form.Free
- end sub
-